/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    height: 100vh;
    overflow: hidden;
}

/* Container with responsive height */
.container {
    width: 100%;
    height: 450px; /* iframe height */
    max-height: 90vh; /* full browser height */
    padding: 10px;
    display: flex;
    gap: 15px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Control Panel Styles */
.control-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 300px;
}

.player-section {
    display: flex;
    gap: 10px;
    height: 140px;
}

.player-card {
    flex: 1;
    background: white;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 2px solid transparent;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.player-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.player-card h3 {
    font-size: 14px;
    margin-bottom: 8px;
    color: #2c3e50;
}

.dice-display {
    font-size: 32px;
    margin: 8px 0;
    transition: transform 0.3s ease;
}

.dice-rolling {
    animation: roll 0.5s ease-in-out;
}

@keyframes roll {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(90deg); }
    50% { transform: rotate(180deg); }
    75% { transform: rotate(270deg); }
}

.attempts-counter {
    font-size: 12px;
    color: #7f8c8d;
    margin-bottom: 4px;
}

.status {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 12px;
    background: #ecf0f1;
    color: #2c3e50;
}

/* Prediction Section */
.prediction-section {
    background: white;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.prediction-section h4 {
    font-size: 14px;
    margin-bottom: 8px;
    color: #2c3e50;
}

.prediction-buttons {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.predict-btn {
    flex: 1;
    padding: 8px 4px;
    border: 2px solid #3498db;
    background: white;
    color: #3498db;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    transition: all 0.3s ease;
    min-height: 44px; /* Touch-friendly */
}

.predict-btn:hover {
    background: #3498db;
    color: white;
    transform: translateY(-1px);
}

.predict-btn.selected {
    background: #3498db;
    color: white;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.prediction-display {
    font-size: 12px;
    color: #27ae60;
    font-weight: 500;
    text-align: center;
    min-height: 16px;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 8px;
}

.action-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    min-height: 48px; /* Touch-friendly */
}

.action-btn.primary {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
}

.action-btn.primary:hover {
    background: linear-gradient(135deg, #229954, #27ae60);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(39, 174, 96, 0.3);
}

.action-btn.secondary {
    background: #95a5a6;
    color: white;
}

.action-btn.secondary:hover {
    background: #7f8c8d;
    transform: translateY(-2px);
}

.action-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Results Panel */
.results-panel {
    flex: 1;
    background: white;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 280px;
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.results-header h4 {
    font-size: 16px;
    color: #2c3e50;
}

.tooltip-icon {
    cursor: help;
    font-size: 16px;
    color: #3498db;
}

/* Progress Bars */
.progress-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.progress-item label {
    font-size: 12px;
    color: #2c3e50;
    margin-bottom: 4px;
    display: block;
}

.progress-bar {
    position: relative;
    height: 24px;
    background: #ecf0f1;
    border-radius: 12px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2980b9);
    border-radius: 12px;
    transition: width 0.5s ease;
    width: 0%;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 11px;
    font-weight: 600;
    color: #2c3e50;
}

/* Statistics Grid */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.stat-item {
    background: #f8f9fa;
    padding: 8px;
    border-radius: 6px;
    text-align: center;
}

.stat-label {
    font-size: 10px;
    color: #7f8c8d;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 16px;
    font-weight: 700;
    color: #2c3e50;
}

/* Insight Panel */
.insight-panel {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
    padding: 10px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.4;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.5s ease;
}

.insight-panel.show {
    opacity: 1;
    transform: translateY(0);
}

/* Success/Failure States */
.success {
    border-color: #27ae60 !important;
    background: linear-gradient(135deg, #d5f4e6, #ffffff) !important;
}

.failure {
    border-color: #e74c3c !important;
    background: linear-gradient(135deg, #fadbd8, #ffffff) !important;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
        height: 90vh;
        padding: 8px;
        gap: 10px;
    }
    
    .player-section {
        height: 120px;
    }
    
    .player-card h3 {
        font-size: 13px;
    }
    
    .dice-display {
        font-size: 28px;
    }
    
    .predict-btn {
        font-size: 10px;
        padding: 6px 4px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr 1fr 1fr;
    }
    
    .stat-item {
        padding: 6px;
    }
    
    .stat-value {
        font-size: 14px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}